package routers

import (
	"gin-mvc/controllers"
	apiv1 "gin-mvc/controllers/api/v1"
	"gin-mvc/middleware"
	"github.com/gin-gonic/gin"
)

func InitTagRouter(router *gin.Engine) {
	v1 := router.Group("/api/v1/tag")
	v1.Use(middleware.UserAuth()) // 使用中间件
	{
		v1.GET("/index", func(context *gin.Context) {
			registerTagController(context).Index()
		})
		v1.GET("/create", func(context *gin.Context) {
			registerTagController(context).Create()
		})
	}
}

func registerTagController(context *gin.Context) *apiv1.TagController {
	return &apiv1.TagController{BaseController: controllers.BaseController{Ctx: context}}
}
